Fix: Normalize FilesTouched paths to prevent missing checkpoint trail…#779
Open
Adityakk9031 wants to merge 1 commit intoentireio:mainfrom
Open
Fix: Normalize FilesTouched paths to prevent missing checkpoint trail…#779Adityakk9031 wants to merge 1 commit intoentireio:mainfrom
Adityakk9031 wants to merge 1 commit intoentireio:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Commits never receive Entire-Checkpoint trailers despite hooks running correctly. The prepare-commit-msg hook finds sessions but logs "no content to link" for all of them.
The root cause is a path format mismatch in
stagedFilesOverlapWithContent
.
getStagedFiles()
returns repo-relative paths (e.g., src/screens/SessionDetail.tsx) from git diff --cached --name-only, but state.FilesTouched stores the exact paths the agent provides — often absolute (e.g., /Users/alex/project/src/screens/SessionDetail.tsx). The touchedSet[stagedPath] lookup silently fails, so no file ever reaches the content comparison logic.
A contributing factor is that opencode export returns invalid JSON, which prevents the active session's live transcript fallback from detecting content.
Solution
Normalize at write time:
mergeFilesTouched
now accepts a worktreePath parameter and normalizes all incoming paths to repo-relative form via a new
normalizeToRepoRelative
helper before storing them in state.FilesTouched.
Basename fallback at read time:
stagedFilesOverlapWithContent
now builds a secondary touchedByBase map keyed by filepath.Base(). When the exact path lookup fails, it falls back to basename matching to handle stale sessions from older CLI versions.
Debug logging: A new log line ("path format mismatch, matched by basename") makes this class of silent failure visible in future.